<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Title</title>
    <!--    导入BootStrap的css文件-->
    <link rel="stylesheet" href="bootstrap3/css/bootstrap.min.css">
    <link rel="stylesheet" href="bootstrap3/css/bootoast.css">
    <!--    导入jquery-->
    <script src="bootstrap3/jquery.js" type="text/javascript" charset="utf-8"></script>
    <!--    导入bootstrap中的js文件-->
    <script src="bootstrap3/js/bootoast.js" type="text/javascript" charset="utf-8"></script>
    <script src="bootstrap3/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
    <style>
        form {
            margin-top: 150px;
        }

        .text-left {
            margin-top: 30px;
        }
    </style>
    <script>
        $(function () {
            //设置用户编号
            val =sessionStorage.getItem("adminId");
            $("#adminId").val(val);
            $('#btnXiu').click(function () {

                if ($('#account2').val() == '') {
                    bootoast({
                        message: '账号不能为空',
                        type: 'danger',
                        position: 'top',
                        timeout: 2
                    });
                } else {
                    if ($('#nickName').val() == '') {
                        bootoast({
                            message: '昵称不能为空',
                            type: 'danger',
                            position: 'top',
                            timeout: 2
                        });
                    } else {

                        $.ajax({
                            url: 'updateAccount',
                            type: 'post',
                            cache: false,
                            data: {
                                newAccount: $('#account2').val(),
                                NickName: $('#nickName').val()
                            },
                            dataType: 'json',
                            success: function (rst) {
                                if (rst.code == -1) {
                                    bootoast({
                                        message: rst.msg,
                                        type: 'danger',
                                        position: 'top',
                                        timeout: 2
                                    });
                                } else {
                                    bootoast({
                                        message: rst.msg,
                                        type: 'success',
                                        position: 'top',
                                        timeout: 2
                                    });
                                    $('#account2').val(''),
                                        $('#nickName').val('')
                                }
                            }
                        });

                    }
                }
            });
        });
    </script>
</head>

<body>
<div class="container-fluid">
    <div class="row">
        <ul class="breadcrumb">
            <li><a href="922welcome.html">首页</a></li>
            <li><a href="#">个人中心</a></li>
            <li>修改个人信息</li>
        </ul>
        <div class="col-sm-4 col-sm-offset-4 ">
            <!--            垂直表单-->
            <form class="text-center">
                <div class="form-group text-left">
                    <label for="adminId">用户编号:</label><br>
                    <input type="text" readonly id="adminId" class="form-control" value="">
                </div>
                <div class="form-group text-left">
                    <label for="account2">用户账号:</label>
                    <input type="text" id="account2" class="form-control">
                </div>
                <div class="form-group text-left">
                    <label for="nickName">用户昵称:</label>
                    <input type="text" id="nickName" class="form-control">
                </div>
                <div class="form-group ">
                    <input type="button" value="修改" id="btnXiu" class="btn btn-success" style="margin-right: 100px">
                    <input type="reset" class="btn">
                </div>
            </form>
        </div>

    </div>
</div>
</body>
</html>